<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>构造一个 APCIterator 迭代器对象</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.apciterator.html">APCIterator</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="apciterator.current.html">APCIterator::current</a></div>
 <div class="up"><a href="class.apciterator.html">APCIterator</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="apciterator.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">APCIterator::__construct</h1>
  <p class="verinfo">(PECL apc &gt;= 3.1.1)</p><p class="refpurpose"><span class="refname">APCIterator::__construct</span> &mdash; <span class="dc-title">构造一个 APCIterator 迭代器对象</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-apciterator.construct-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>APCIterator::__construct</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$cache</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$search</code><span class="initializer"> = null</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$format</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$chunk_size</code><span class="initializer"> = 100</span></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$list</code></span>
  ]]]] )</div>

  <p class="para rdfs-comment">
   构造一个 <a href="class.apciterator.html" class="classname">APCIterator</a> <span class="type"><a href="language.types.object.html" class="type object">object</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-apciterator.construct-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<em><code class="parameter">cache</code></em></dt>

    <dd>

     <p class="para">
      缓存类型，可以是 <em>user</em> 或者
      <em>file</em>。
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">search</code></em></dt>

    <dd>

     <p class="para">
      匹配 APC 键名的 <a href="book.pcre.html" class="link">PCRE</a> 正则表达式，既可以是单个正则表达式 <span class="type"><a href="language.types.string.html" class="type string">string</a></span>，也可以是 <span class="type"><a href="language.types.array.html" class="type array">array</a></span> 的正则表达式。或者可以是 <strong><code>NULL</code></strong> 来略过搜索。
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">format</code></em></dt>

    <dd>

     <p class="para">
      需要的格式可以用一个或多个
      <a href="apc.constants.html" class="link">APC_ITER_*</a> 常量。
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">chunk_size</code></em></dt>

    <dd>

     <p class="para">
      块的大小。必须是一个大于0的值，默认是100。
     </p>
    </dd>

   
   
    <dt>
<em><code class="parameter">list</code></em></dt>

    <dd>

     <p class="para">
      需要列出的类型。可以是 <strong><code>APC_LIST_ACTIVE</code></strong>
      或 <strong><code>APC_LIST_DELETED</code></strong>。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-apciterator.construct-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <a href="class.apciterator.html" class="classname">APCIterator</a> <span class="type"><a href="language.types.object.html" class="type object">object</a></span>，失败时返回 <strong><code>NULL</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-apciterator.construct-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-393">
    <p><strong>Example #1 A <span class="function"><strong>APCIterator::__construct()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">foreach&nbsp;(new&nbsp;</span><span style="color: #0000BB">APCIterator</span><span style="color: #007700">(</span><span style="color: #DD0000">'user'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'/^counter\./'</span><span style="color: #007700">)&nbsp;as&nbsp;</span><span style="color: #0000BB">$counter</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$counter</span><span style="color: #007700">[</span><span style="color: #0000BB">key</span><span style="color: #007700">]</span><span style="color: #DD0000">:&nbsp;</span><span style="color: #0000BB">$counter</span><span style="color: #007700">[</span><span style="color: #0000BB">value</span><span style="color: #007700">]</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">apc_dec</span><span style="color: #007700">(</span><span style="color: #0000BB">$counter</span><span style="color: #007700">[</span><span style="color: #DD0000">'key'</span><span style="color: #007700">],&nbsp;</span><span style="color: #0000BB">$counter</span><span style="color: #007700">[</span><span style="color: #DD0000">'value'</span><span style="color: #007700">]);<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-apciterator.construct-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.apc-exists.html" class="function" rel="rdfs-seeAlso">apc_exists()</a> - 检查APC中是否存在某个或者某些key</span></li>
   <li class="member"><span class="function"><a href="function.apc-cache-info.html" class="function" rel="rdfs-seeAlso">apc_cache_info()</a> - Retrieves cached information from APC's data store</span></li>
  </ul>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="class.apciterator.html">APCIterator</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="apciterator.current.html">APCIterator::current</a></div>
 <div class="up"><a href="class.apciterator.html">APCIterator</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
